C-Level Extensibility > The C-level extensibility API > char *JS_ValueToString()

 

char *JS_ValueToString()

Description

Extracts a function argument from a jsval, converts it to a string (if possible), and passes the converted value back to the caller.

Arguments

JSContext *cx, jsval v, unsigned int *pLength

cx is the opaque JSContext pointer that was passed to the JavaScript function.
v is the jsval from which the string is to be extracted.
pLength is a pointer to an unsigned integer. This function sets *plength equal to the length of the string in bytes.

Returns

A pointer to a string on success or null on failure.